//
//  DTLUserLeftView.m
//  DTLLiteProject
//
//  Created by Kendama on 2017/7/18.
//  Copyright © 2017年 JianWei Chen. All rights reserved.
//

#import "LeftView.h"

@interface LeftView ()


@end

@implementation LeftView

#pragma mark - 代理


#pragma mark - 初始化
- (instancetype)init
{
    self = [super init];
    if (self)
    {
        [self masLayoutSubview];
        
    }
    return self;
}

- (UITableView *)tableView
{
    if(!_tableView)
    {
        UIView *superView = self;
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStyleGrouped];
        [superView addSubview:_tableView];
        _tableView.backgroundColor = [UIColor whiteColor];
        _tableView.separatorStyle = UITableViewCellSelectionStyleNone;
    }
    return _tableView;
}

- (UIImageView *)avatarView
{
    if(!_avatarView)
    {
        UIView *superView = self;
        _avatarView = [[UIImageView alloc]init];
        [superView addSubview:_avatarView];
        _avatarView.layer.cornerRadius = px1920Height(268)/2;
//        _avatarView.image = [UIImage imageNamed:@"icon_head"];
        _avatarView.layer.masksToBounds = YES;
    }
    return _avatarView;
}
- (UILabel *)nicknameLabel
{
    if(!_nicknameLabel)
    {
        UIView *superView = self;
        _nicknameLabel = [[UILabel alloc]init];
        [superView addSubview:_nicknameLabel];
//        [_nicknameLabel setFont:[UIFont systemFontOfSize:15]];
        [_nicknameLabel setTextColor:[UIColor darkGrayColor]];
        _nicknameLabel.text = @"玫瑰";
    }
    return _nicknameLabel;
}


- (void)masLayoutSubview{
    __weak UIView *superView = self;
    UIView *statusBar = [[UIView alloc] init];
    statusBar.backgroundColor = [UIColor colorWithRed:242/255.0 green:166/255.0 blue:167/255.0 alpha:0.5];
    [super addSubview:statusBar];
    [statusBar mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_top);
        make.left.right.equalTo(superView);
        make.height.mas_equalTo(px1920Height(65));
    }];

    [self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_top).with.offset(px1920Height(140));
        make.centerX.equalTo(superView);
        make.width.height.mas_equalTo(px1080Width(268));
    }];
    
    [self.nicknameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.avatarView.mas_bottom).with.offset(px1920Height(47));
        make.centerX.equalTo(superView);
    }];
    
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nicknameLabel.mas_bottom).with.offset(px1920Height(171));
        make.left.right.equalTo(superView);
        make.bottom.equalTo(superView.mas_bottom);
    }];
    
}
@end
